package com.bl.student.service.biz.notice.impl;

import com.bl.student.dao.model.NoticeEntity;
import com.bl.student.dao.repository.NoticeRepository;
import com.bl.student.service.biz.notice.NoticeService;
import com.bl.student.service.vo.goods.GoodsAddVo;
import com.bl.student.service.vo.notice.NoticeAddVo;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by liangweikang on 19/7/4.
 */
@Service
@Log4j2
public class NoticeServiceImpl implements NoticeService {

    @Autowired
    NoticeRepository noticeRepository;

    @Override
    public void add(NoticeAddVo noticeAddVo) {
        NoticeEntity noticeEntity = noticeRepository.findOne("notice001");
        noticeEntity.setImage(noticeAddVo.getImage());
        noticeEntity.setName(noticeAddVo.getName());
        noticeRepository.save(noticeEntity);
    }

    @Override
    public NoticeEntity getNotice() {
        return noticeRepository.findOne("notice001");
    }
}
